// -*- mode: c++; coding: utf-8 -*-

#include <Ice/Identity.ice>
#include <Ice/BuiltinSequences.ice>

#include <RobotsData.ice>

module Robots {

  interface Agent;
  sequence<Agent*> AgentSeq;

  interface Robot;
  sequence<Robot*> RobotSeq;

  // The AgentTeam interface allows to populate teams
  // with agents (and their relative robots).
  interface AgentTeam {
    AgentSeq create (RobotSeq robots);
    idempotent AgentSeq list ();
  };

  // Used for admin purposes.
  // Each robot is identified by a string that
  // refers to the physical robot IP.
  interface RobotFactory {
    RobotSeq create (Ice::StringSeq addresses);
    idempotent RobotSeq list ();
  };  

  // The auctioneer manages the bidding process.
  // Currently, it is used by agents to assign signposts.
  interface Auctioneer {
    ["ami"] void begin ();
    ["ami"] void receiveBid (Bid b);
    Agent* getLeader (SignPost sp);
  };

  // The Agent interface.
  // inform --> used to send messages to an agent.
  interface Agent {
    ["ami"] void inform (Message m);
    void destroy ();
  };

  exception AlreadySubscribed {};

  // The Camera interface.
  interface Camera {
    // getRobotPos gets the position of a certain robot.
    idempotent RobotPos getRobotPos (Ice::Identity robot);
    // getSignPostPositions gets the positions of the signpots.
    idempotent SignPostSeq getSignPostPositions ();

    // subscribed and unsubscribe may be used to send
    // periodical events to agents.
    void subscribe (Agent* a) throws AlreadySubscribed;
    void unsubscribe (Agent* a);
  };

  // The Robot interface.
  interface Robot {
    // moves the robot to B.
    // to  --> B.
    // sp  --> the speed.
    ["ami"] void move (RobotPos to,
		       Speed sp);
    // get an image from the camera with a certain resolution.
    Ice::ByteSeq capture (Resolution res);
    // turn on/off the laser.
    void setLaser (bool on);
    void destroy ();
  };
  
};
